package model;


import static org.junit.Assert.*;

import java.awt.Color;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import model.playingfield.PlayingField;

/**
 * This test tries moving players 1 piece around the circuit and into that
 * players runway. It should land somewhere appropriate on the runway.
 */
public class PlayingFieldTest12 {
	
	PlayingField playingfield;
	Player[] players;
	
	@Before
	public void setUp() throws Exception {
	
	Player p1 = new Player("Nils", Color.black, 0); 
	Player p2 = new Player("Mils", Color.blue, 1); 
	Player p3 = new Player("Wils", Color.red, 2);
	Player p4 = new Player("Kils", Color.green, 3);
	
	Player[] playersSet = {p1, p2, p3, p4};
	players = playersSet;
	
	playingfield = new PlayingField(players);
	}
	
	@Test
	public void testPieceMove() throws Exception {
		playingfield.movePiece(56, 1);
		playingfield.movePiece(1, 40);
		
		Integer[][] pieceIndex = playingfield.getPieceLocations();

		assertTrue(pieceIndex[0][0] == 40  && 
				   (playingfield.getSpot(40).getOccupant().getID() == 0) && 
				   (playingfield.getSpot(40).getOccupant().getOwner() == players[0]));
	}

	@After
	public void tearDown() throws Exception {
	}

}
